plans: restore free tier in Default() so api tests pass + email gate works#4
Merged
Merged
Conversation
The api repo's plans tests (TestDefault_AllStandardTiersPresent, TestAll_ReturnsAllPlans, TestFreeTier_MirrorsAnonymous) require a `free` tier in the default registry. The api-level plans.yaml already defines `free` as a byte-for-byte clone of `anonymous` (same limits, same features) — the only difference being audience (free = claimed-but-unpaid teams, anonymous = pre-claim agents). Both still get reaped at 24h, so the pay-from-day-one policy holds. The `free` tier is real product surface, not test scaffolding: - api/internal/handlers/billing.go:361 sets tier="free" for unpaid teams - api/internal/handlers/webhook.go:411-416 reaps both anonymous and free - api/internal/handlers/openapi.go advertises "free" in 3 schemas - api/internal/models/resource_elevate_test.go uses tier "free" - api/internal/handlers/onboarding_test.go asserts tier == "free" The FREE-TIER-RECYCLE-2026-05-12.md plan also depends on `free` existing in the registry (Option B email-gate falls into this tier). Mirroring rule: anonymous and free must stay byte-identical so that an anonymous->free flip at claim time cannot widen or narrow quotas. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The api repo's plans tests (
TestDefault_AllStandardTiersPresent,TestAll_ReturnsAllPlans,TestFreeTier_MirrorsAnonymous) require afreetier in the common-module default registry. It was missing fromdefaultYAMLincommon/plans/plans.go(onlyanonymous,hobby,pro,team,growth). This PR restoresfreeas a byte-for-byte mirror ofanonymous.Why free is real surface (not just test scaffolding)
api/internal/handlers/billing.go:361setstier = "free"for unpaid teamsapi/internal/handlers/webhook.go:411-416reaps bothanonymousandfreeat 24h TTLapi/internal/handlers/openapi.goadvertises"free"in 3 enum schemasapi/internal/models/resource_elevate_test.go:142uses tier"free"api/internal/handlers/onboarding_test.go:166assertstier == "free"api/plans.yamlalready defines afreeblock (lines 40-64), butDefault()is hardcoded and ignores any yamlFREE-TIER-RECYCLE-2026-05-12.mdOption B (email gate) explicitly depends onfreeexistingAudience contract
anonymousfreePay-from-day-one policy holds: both get reaped at 24h. The two tiers must stay byte-identical so an
anonymous->freeflip at claim time cannot widen or narrow quotas.Test plan
go test ./plans/...in common): 19 pass, 1 skip (file-consistency skipped — no plans.yaml in common repo)go test ./internal/plans/...in api with replace-directive): 17 pass (was 3 failing — now all 3 named tests green:TestDefault_AllStandardTiersPresent,TestAll_ReturnsAllPlans,TestFreeTier_MirrorsAnonymous)freein the default registry assertionsCo-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com